package com.by.facade.enums.order;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;

@Getter
@AllArgsConstructor
public enum OrderThirdpartyTypeEnum {

    WX(1, "微信"),
    ALIPAY(2, "支付宝"),
    CORP_ACCOUNT(3, "对公账户打款"),
    ;

    private Integer code;
    private String desc;

    private static final Map<Integer, OrderThirdpartyTypeEnum> MAP = Arrays.stream(OrderThirdpartyTypeEnum.values())
            .collect(Collectors.toMap(OrderThirdpartyTypeEnum::getCode, Function.identity()));


    public static OrderThirdpartyTypeEnum resolve(Integer code) {
        return MAP.get(code);
    }

}
